UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'yWRVgr/0Bmk1x9MMv7GJyWSCgt7PESEkXTU6arkMTgE='
WHERE
key_id = '4a2f0e27fcc88d015e04fc17be9916ce5c4317bdc20929372a27319aef2166cb'
AND (
token = 'yWRVgr/0Bmk1x9MMv7GJyWSCgt7PESEkXTU6arkMTgE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)