UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uQB4yuwtBB/3J0bmoqJqRLdFzmRYnv+hEWnT+tYisvE=' 
WHERE 
  key_id = 'da4c574fc4e4ec9fd30e21d6fb845687aba565a14f3feb3284b7715baf626ed3' 
  AND (
    token = 'uQB4yuwtBB/3J0bmoqJqRLdFzmRYnv+hEWnT+tYisvE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032