UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'u66YTVMHvdB9WRE9THBY15iaFklOGIbKwC2UnFCF498='
WHERE
key_id = '82ab21067acd481a81d2024e47b88e154df8ff0ca0cb7d6f24f4ee9d9d37b3cb'
AND (
token = 'u66YTVMHvdB9WRE9THBY15iaFklOGIbKwC2UnFCF498='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)