UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'H8wiApYnRwO8MXmITHlHFyPUgHkJWmVm8Qbg2JSr9FM='
WHERE
key_id = '8a0640d0e331c7f37c10d040c0919b4abed84f185394a9d3e764a00ae9c07e7e'
AND (
token = 'H8wiApYnRwO8MXmITHlHFyPUgHkJWmVm8Qbg2JSr9FM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)