UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5aeN543mIZEXHW5ue8Mif9goxNdJ1bh0kgk0lfz+DS4='
WHERE
key_id = '2e888b3fe51a62e9c02e8e4150c7162b3e042902fc9e966f509d0e93a2c84b62'
AND (
token = '5aeN543mIZEXHW5ue8Mif9goxNdJ1bh0kgk0lfz+DS4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)