UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'jYMj4QY9X2G8Y8764efXD6LQ8yEBMzN91FSV7cElHeo='
WHERE
key_id = '0ef5b9885155716abac39f54ea9d51958a2ce09fbd238b258def68df4edcfda1'
AND (
token = 'jYMj4QY9X2G8Y8764efXD6LQ8yEBMzN91FSV7cElHeo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)