UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9gxJC5p1bh4esb1Px+akuf7Rhk0844O+0TGt99L/3VM=' 
WHERE 
  key_id = '839d23f60eca8a3eedc3e9a9670221fec517a98a9629a3aa088e7f13969d9179' 
  AND (
    token = '9gxJC5p1bh4esb1Px+akuf7Rhk0844O+0TGt99L/3VM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030