UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '83KYegV4JFmGzcDA7pNdKWJtwlMpVDEamKswtol6iGU='
WHERE
key_id = 'ba133dfe6fe312a4bb883d84a0be5a8af73b9cc06f3163ce221e45e94054600a'
AND (
token = '83KYegV4JFmGzcDA7pNdKWJtwlMpVDEamKswtol6iGU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)