UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '40RqdeLsME/QXu8hvVGXmGWmfFD4qaxnTqjg7DfvFBk='
WHERE
key_id = '599cb7caff65a6969a02a71a475a6f7aa3bf49eabcbd5128a5b1f002f0d6d555'
AND (
token = '40RqdeLsME/QXu8hvVGXmGWmfFD4qaxnTqjg7DfvFBk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)