UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CfK06DtE7si1eHxfBdnAUU34DiRy3HEvCwkMKPt+zqY=' 
WHERE 
  key_id = 'd571d23807db6756e246d881e312846627c009d9622266b3887385287f29f2e4' 
  AND (
    token = 'CfK06DtE7si1eHxfBdnAUU34DiRy3HEvCwkMKPt+zqY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00060