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

Query time 0.00045