UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'h3jMKVmG6deNf81KjDlCEOsn95Z2Qk7ThT21w5OlWdc=' 
WHERE 
  key_id = '247ad00fd31bdcd4b95572545afea3347170b5cbace1a3678d98a317fd37305d' 
  AND (
    token = 'h3jMKVmG6deNf81KjDlCEOsn95Z2Qk7ThT21w5OlWdc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036