UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'n0jy1o6WTwsq8SBGXn8rASqQI2Qx2G7b8nsjLI54H8w='
WHERE
key_id = 'bc6193dd02e0d0918c7b644b0d6d31527c7286eff20d7afa055b72effcba0966'
AND (
token = 'n0jy1o6WTwsq8SBGXn8rASqQI2Qx2G7b8nsjLI54H8w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)