UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'aPLBtBIeSWHPRgfEGiOA1WbJBc8jIRJb6d3XG/QEguY='
WHERE
key_id = 'ef19a9a640a145fcc018cf819fbe702647a8bf9bc7d1e07caa4836709269faf6'
AND (
token = 'aPLBtBIeSWHPRgfEGiOA1WbJBc8jIRJb6d3XG/QEguY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)