UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Pg8IA379U8+WIwTZZwaFDZ5EQr62qR1cEsfTpN8coCU=' 
WHERE 
  key_id = '1a2166b8a36cf05537998d46221074bb34d17c38a2e72c973650229a471a86b9' 
  AND (
    token = 'Pg8IA379U8+WIwTZZwaFDZ5EQr62qR1cEsfTpN8coCU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025