UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'WnpebgZhGr2PTi2UHidDAqpU5Vrv5wRxRgh+uFrQRAo='
WHERE
key_id = 'f505bd4b9298d57129a7b12fde8c174cb993c6f1b2b479b59df89ddd0ed860f0'
AND (
token = 'WnpebgZhGr2PTi2UHidDAqpU5Vrv5wRxRgh+uFrQRAo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)