UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'E2k+jMXbC94Ko3PIgp7nQfmFtBUzIN8d3Zqq1piFSb0=' 
WHERE 
  key_id = '4b6d3a991348e09583bc717aedcb709d83b61c311d9e19c83e51f4fbc7c6d965' 
  AND (
    token = 'E2k+jMXbC94Ko3PIgp7nQfmFtBUzIN8d3Zqq1piFSb0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036