UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xF60ni+FNfQ+FyZrIDFOZewlu31XT2roBc0pT9EBDDc=' 
WHERE 
  key_id = '77bc575db53541c3a1772da25d05576d9cec68de30f8c028e8727872393d1d41' 
  AND (
    token = 'xF60ni+FNfQ+FyZrIDFOZewlu31XT2roBc0pT9EBDDc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029