UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xGTHrln+WdwmdkchN80FPDdhYrDq3ns3iENsd2cpJL4=' 
WHERE 
  key_id = '0f52fc00d8791c3cf9c78e5d1b47e9005e827207ee9302327f2eb58b8e89498a' 
  AND (
    token = 'xGTHrln+WdwmdkchN80FPDdhYrDq3ns3iENsd2cpJL4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030