UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IvmLzd23EyQTpDJLHvzAwg+d0qt3C9BMzq8sORe0CwI=' 
WHERE 
  key_id = '13e0c245adb2e398756e4621b7c7ada2811c9e951dc094d25a331dffa346beb6' 
  AND (
    token = 'IvmLzd23EyQTpDJLHvzAwg+d0qt3C9BMzq8sORe0CwI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029