UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BmsHQDYHEbbYUmcvZyIybevkZ3Zp2rIriCTzbFH5y2c='
WHERE
key_id = 'eefbb40e9622409a9d417634ed670a2fd56a70afa81f9cb91633fc0cee3a204e'
AND (
token = 'BmsHQDYHEbbYUmcvZyIybevkZ3Zp2rIriCTzbFH5y2c='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)