UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Jws2r2jKEnGVvy9Op9W8YqV2lLl3BXPKRGrOtBgdgEw=' 
WHERE 
  key_id = '464e996fff0810dc616c905f510fd0b713d2e309bc473740ff24f0d464937bec' 
  AND (
    token = 'Jws2r2jKEnGVvy9Op9W8YqV2lLl3BXPKRGrOtBgdgEw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00069