UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cdhsi9fhrZP8QAuzP+p8G5mk7HJRFoMtQ9bluDd/PdM=' 
WHERE 
  key_id = '22ec3804922036d9efadbde39f32646427da945f6ff7f7f791cd017db82bb8ed' 
  AND (
    token = 'cdhsi9fhrZP8QAuzP+p8G5mk7HJRFoMtQ9bluDd/PdM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043