UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gXZlx7QUFxFGGEJ8pCWR3ogDyWJK9z2gL+C5Pq3NiMU=' 
WHERE 
  key_id = '18f1eeca37b749ffc8e3b421490c82b0ea18b460d9862d5986a92d5e48d343f2' 
  AND (
    token = 'gXZlx7QUFxFGGEJ8pCWR3ogDyWJK9z2gL+C5Pq3NiMU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030