UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ECWrFZ5d1BI3LseVMxxImUaULz1JeG/o4Pb4k8hEvnE='
WHERE
key_id = 'a47b816c76ede901ef5b41cf1c75feb65005d44548839b186caf0c7a07f57381'
AND (
token = 'ECWrFZ5d1BI3LseVMxxImUaULz1JeG/o4Pb4k8hEvnE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)