UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nss46kgmB22UCMHXaC7bQXKnbb32WwO336bshBRlwfo=' 
WHERE 
  key_id = 'e6d96aff5f060173b78a4495d796524e004481e5ef6179c972bab2bd511e24e2' 
  AND (
    token = 'nss46kgmB22UCMHXaC7bQXKnbb32WwO336bshBRlwfo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044