UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'kNQJKfr/JYVuVywES3ftZ3oX2dtn4myOFVYfdh5eVbs='
WHERE
key_id = '47aa99fb94811de6f0efc65f9eb48a8272f5262b3696a16102f8a9d3d3913780'
AND (
token = 'kNQJKfr/JYVuVywES3ftZ3oX2dtn4myOFVYfdh5eVbs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)