UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3hB/0XZ7LGQoeUufGh5lpTvBcycWWYfgqF0XYoxN5vw='
WHERE
key_id = 'a923eff79e69de381a21e83d8c1925ee4b5c4fd172434c6294be27c674eeacec'
AND (
token = '3hB/0XZ7LGQoeUufGh5lpTvBcycWWYfgqF0XYoxN5vw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)