UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GZWzwBhYuILQG/1VFuX5AqGQ9BDlfQ9GM5f1bi6wJ/Y=' 
WHERE 
  key_id = '8f2c23b27777855ebed14d689642484378a722470b73c945059c40af3446f279' 
  AND (
    token = 'GZWzwBhYuILQG/1VFuX5AqGQ9BDlfQ9GM5f1bi6wJ/Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032