UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WATLPBPlXIYVp++T9cI+Xw3265OOd5QozxtTalDHhh0=' 
WHERE 
  key_id = '17498967bf1568bb08e14a69ddafec9a75628fb9591f8acef0e8fbc6f4a2d50b' 
  AND (
    token = 'WATLPBPlXIYVp++T9cI+Xw3265OOd5QozxtTalDHhh0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026