UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KU/Hgsm+7Ku2pJfLnJo0F6HgknoTcz3s+k1tqfS96aM=' 
WHERE 
  key_id = '7e754fc2234fe11481cd6cf8944c8061bc792f209b106d9fc735596b23ad1501' 
  AND (
    token = 'KU/Hgsm+7Ku2pJfLnJo0F6HgknoTcz3s+k1tqfS96aM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031