UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'K1eHMr366rXsSU7aAF1o2/+QQx980JwZyleoYImwzVc=' 
WHERE 
  key_id = '7377d9272d45c8e75f68f6233c4bc54f08784a02689fb9d8ae23c67cf8c6adf3' 
  AND (
    token = 'K1eHMr366rXsSU7aAF1o2/+QQx980JwZyleoYImwzVc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033