UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9bTH+zOtEr8nJk3VgdqsEF8QqVZdzYtULAeaS5kP8xE=' 
WHERE 
  key_id = '1ba938249c99061e0d5dace80e2e71d7992830dbec929303e673495d630a6995' 
  AND (
    token = '9bTH+zOtEr8nJk3VgdqsEF8QqVZdzYtULAeaS5kP8xE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00055