UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'rcunsyFjXAcv9ISLejqczf1qlIz0YD/gsmBPWJnYZD4='
WHERE
key_id = '1631db55a7476a65875b4e1261352d2c25a8f5b0879bb871a2702c67b1aa4d17'
AND (
token = 'rcunsyFjXAcv9ISLejqczf1qlIz0YD/gsmBPWJnYZD4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)