UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Br1vv3WafUx+vghWSKDHRCUPuS5l/fYKJSXZX6txq68=' 
WHERE 
  key_id = '9a0fef5bb865fee58b2d8dc87fa820d470518cd67388756f1bc5042c91a60f8f' 
  AND (
    token = 'Br1vv3WafUx+vghWSKDHRCUPuS5l/fYKJSXZX6txq68=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031