UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TafRcgky3kiaVSCKP43uaA7eiibp/Atecv2F9PgXUb8=' 
WHERE 
  key_id = '06317dcf98eea9070d136f2419f2a6b73fd1d29eea2b88716197874c76e9f07a' 
  AND (
    token = 'TafRcgky3kiaVSCKP43uaA7eiibp/Atecv2F9PgXUb8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027