UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dNKhUkb7VOmfflIXq5m2PrwH8gPGgl1xKNd/k3YxuQ4=' 
WHERE 
  key_id = '52478689cd9a0c290c56986ce26badfda4953b273ce425afc80bd0d07cfae14b' 
  AND (
    token = 'dNKhUkb7VOmfflIXq5m2PrwH8gPGgl1xKNd/k3YxuQ4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017