UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'IJBN0ClPcbiU1Af66acXXKQpaaN9nFfh7+kEfQn+LdA='
WHERE
key_id = '3eee3721a810d43b8d9373b9df61370835a6afdd31d15e6f63a6be30d69360c6'
AND (
token = 'IJBN0ClPcbiU1Af66acXXKQpaaN9nFfh7+kEfQn+LdA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)