UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IJfnPt7A2qYiNSea3yLhD9DWdpn+652f58p9tVUuY3U=' 
WHERE 
  key_id = 'fad1ba880d5981cef9d3aedd33402e3fde99fa35be63da2c8bfd19365c36a864' 
  AND (
    token = 'IJfnPt7A2qYiNSea3yLhD9DWdpn+652f58p9tVUuY3U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043