UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0CGbw7QH+UHI1AR3sC5QF24CcYB+BOhtoiz2Bqiw2ws='
WHERE
key_id = 'e3dc7d2a827d423f7f3865f85a16f69a030736301b6a46c45b187792d3eec2e3'
AND (
token = '0CGbw7QH+UHI1AR3sC5QF24CcYB+BOhtoiz2Bqiw2ws='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)