UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OYUfvK2yg62HNuyZB0ZRqr3uS1tDdJ7bPU2WGfhFhNM=' 
WHERE 
  key_id = 'd38ff9eea697df7d087ed83a0307422304bd2e672a748eb62fba5efd649c1e43' 
  AND (
    token = 'OYUfvK2yg62HNuyZB0ZRqr3uS1tDdJ7bPU2WGfhFhNM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036