UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'h+O0iMUtendkRWxrpE9AVUC4wD83k9og+gIPQh2XTLk='
WHERE
key_id = '7ab2fc21e60c73639643742dfb11e007380e7759275940c054cff780d70e8e3b'
AND (
token = 'h+O0iMUtendkRWxrpE9AVUC4wD83k9og+gIPQh2XTLk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)