UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'A+2TpPTUdhytEeXdqqI5zHajE/B6WXVYopJ8fMCv3fA='
WHERE
key_id = '3d29a9cd68d2c63569d9c2abc12d762bce7651af2931878c9b15c7f5d67d0111'
AND (
token = 'A+2TpPTUdhytEeXdqqI5zHajE/B6WXVYopJ8fMCv3fA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)