UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'kWqmeaDkkVo1CJk+aeVmG5HrjVjC2ml+evoX8o+3TTo='
WHERE
key_id = 'b4067aca5f4c7b81e092c282dfd7065b4c7a2260c3b823cfa870b135a509f440'
AND (
token = 'kWqmeaDkkVo1CJk+aeVmG5HrjVjC2ml+evoX8o+3TTo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)