UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SDKuUWbYaZ0bu5R0JDj2HdKVeAa4ZphpY6BmN6a96DA=' 
WHERE 
  key_id = '7aa57c842276fac8985162a11669dade7d2a7c5afd9d1483c9e062f57c37516e' 
  AND (
    token = 'SDKuUWbYaZ0bu5R0JDj2HdKVeAa4ZphpY6BmN6a96DA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032