UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'j+2bwAc3GNtgYbhR2d/H1E0Sx0yWa9tKHrak/QwCows='
WHERE
key_id = 'c9d5b2fa73ac76ad5199fa050119da5395b09c528d66a013937138a5c3be48ed'
AND (
token = 'j+2bwAc3GNtgYbhR2d/H1E0Sx0yWa9tKHrak/QwCows='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)