UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'GrEejeszoojrx1dVvHa2C9XeOPSh3iPsyXas62vL0Uk='
WHERE
key_id = '5597c3b0c49ec8a8c1c9463f4bacd4f7ad8e4b7577eb5a950e553d0a17dba28f'
AND (
token = 'GrEejeszoojrx1dVvHa2C9XeOPSh3iPsyXas62vL0Uk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)