UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'G0AmnwG86QI5fZK3VufOb57szApgOsNPX79l6cIuGh8=' 
WHERE 
  key_id = 'df8639533501ec11491b6f362d873792365de37a8517e1d886e3bde15e90a246' 
  AND (
    token = 'G0AmnwG86QI5fZK3VufOb57szApgOsNPX79l6cIuGh8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00055