UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YmAuxVyDEPvwWRyIBJpfdx/i8/AuwwUoqyXx2bc2OTY=' 
WHERE 
  key_id = 'bf988098a70507ea3d077650f1dd0dc681e2aa69b6033c0aa4aa071294a9e476' 
  AND (
    token = 'YmAuxVyDEPvwWRyIBJpfdx/i8/AuwwUoqyXx2bc2OTY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035