UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'a8fxqzWmDPeMhVo5qt4u9BOzWXl49FzSelTUPYoERt8='
WHERE
key_id = '00852ad5c6d19c4efd12f9ef9dbd93ce6c71d5a8d99a5700368d5c13305c3547'
AND (
token = 'a8fxqzWmDPeMhVo5qt4u9BOzWXl49FzSelTUPYoERt8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)