UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Ri464aSplQ0/rK/U7IcB2OS/9fYTEtPi5hlQatU2P4I='
WHERE
key_id = '3df7687e76a0afec0f55a1b31d9cdf07ef93c09d2e6de75665997522d9d905fe'
AND (
token = 'Ri464aSplQ0/rK/U7IcB2OS/9fYTEtPi5hlQatU2P4I='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)