UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'AEnsglzhnt1b1o4YQb3Ri+L46fY3eUjxVB0rmrMHTx4='
WHERE
key_id = 'ca2c4319d92afb0241f6c003424e0259f528a23566c841e3783eac8fb427d9f8'
AND (
token = 'AEnsglzhnt1b1o4YQb3Ri+L46fY3eUjxVB0rmrMHTx4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)