UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tlOQbXUj8Y0+rLCHP5swwjCt+0LYu8lrPKx1mLcYPb4=' 
WHERE 
  key_id = '04988f8c923f63664ea535bc2a9fb8423ec23ba5841ca90d53a3325d8820c692' 
  AND (
    token = 'tlOQbXUj8Y0+rLCHP5swwjCt+0LYu8lrPKx1mLcYPb4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032