UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'y619GG6V18io+F5nUMw8iHxoJPtD547YD2ia7+ziiOY=' 
WHERE 
  key_id = '7acd184adbf447b924ff04630a9fba98593fd3319d4542dbe2012e3ffc24a181' 
  AND (
    token = 'y619GG6V18io+F5nUMw8iHxoJPtD547YD2ia7+ziiOY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026