UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'IUn5fTPzqAvU042d2BeVpy0tiEMsskbCnKCsd18ZSK4='
WHERE
key_id = 'c725e617f4e4faa1b82e71bd9ba88bbc9cdae9a3c370ea5ee5536458fdc200c1'
AND (
token = 'IUn5fTPzqAvU042d2BeVpy0tiEMsskbCnKCsd18ZSK4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)