UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LbHxH91wrF5rqKprItsrKsNEthNOnFgNzQ9Z+4HUWxk=' 
WHERE 
  key_id = 'b4d90fc4b6e4e891a0ea81b9bdaf3490637407044d506213b7eaf334bdb27479' 
  AND (
    token = 'LbHxH91wrF5rqKprItsrKsNEthNOnFgNzQ9Z+4HUWxk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00053