UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aaXZCAoNCKPGOTHOTCC+p3M/FL5KBMzfy2r56lHcuU4=' 
WHERE 
  key_id = '7a884f66e553cd4ddbbadcc78bf7ee7808babd5d11aeb044d77fe3a1d224a22a' 
  AND (
    token = 'aaXZCAoNCKPGOTHOTCC+p3M/FL5KBMzfy2r56lHcuU4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021