UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ow37uw67S3f1qqJuXL94Oywkv3Hwf4+o+BH6Nh7xxhU=' 
WHERE 
  key_id = '5049dd142738b4c82edef26559761ae20b0f2bd1830ef2e09652ea1113b1afff' 
  AND (
    token = 'Ow37uw67S3f1qqJuXL94Oywkv3Hwf4+o+BH6Nh7xxhU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00056