UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Cs0PyvJ2KK68r/AJsR4F7RICdS8QRat1F1KDZxJ6l1I=' 
WHERE 
  key_id = '07c5837008e6440924dcc094ba85f3f629ec1cbfb1f9f0efc1da1da64998394b' 
  AND (
    token = 'Cs0PyvJ2KK68r/AJsR4F7RICdS8QRat1F1KDZxJ6l1I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031